<template>
  <el-dialog title="请选择部门" :visible.sync="showView" width="430px">
    <div style="margin-top: 20px">
      <el-radio-group v-model="currentValue">
        <el-radio
          v-for="(item, index) in checkedItems"
          :label="item"
          :key="index"
        >
          {{ item }}
        </el-radio>
      </el-radio-group>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="makeSure">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: 'ChooseSection',
  props: {
    checkedItems: {
      type: Array,
      default() {
        return []
      }
    },
    item: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      showView: false,
      currentValue: ''
    }
  },
  mounted() {
    this.currentValue = this.item
  },
  methods: {
    makeSure() {
      this.showView = false
      this.$emit('ChooseSection', this.currentValue)
    }
  }
}
</script>
